
const { db, command, cloud } = require(':share/webServer')


function dbCheck(rsp, option = {})
{
    console.log(rsp)
    if (option.noEmpty === true)   //数据要不为空
    {
        if (rsp.data?.length === 0 || rsp.deleted === 0)
            throw {
                msg: 'no row matched'
            }
    }
    if (rsp.code !== undefined)
    {
        throw {
            msg: rsp.msg
        }
    }
    return rsp
}

module.exports = {
    dbCheck
}